ποΈGitΠ―ΡΠ°ποΈ
Node / meshtastic / Meshtastic-Android / files / .github / agents / speckit.brownfield.migrate.agent.md
.github/agents/speckit.brownfield.migrate.agent.md gh-readonly-queue/main/pr-6745-07b5a8d1c1cfbab58c73f12c8fc7fc2770002893 (7bc67225) Text, 6.00 KB
description: Incrementally adopt SDD for existing features with reverse-engineered
specs
<!-- Extension: brownfield -->
<!-- Config: .specify/extensions/brownfield/ -->
Migrate Existing Features
Reverse-engineer spec-kit artifacts (spec.md, plan.md, tasks.md) for features that were built before spec-kit was adopted. This brings existing work into the SDD workflow so teams can track, refine, and extend features using spec-kit commands.
User Input
T282828
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty). The user may specify a feature or module to migrate (e.g., "auth system", "payments module"), a branch name, or "all" to migrate everything.
Prerequisites
1. Verify a spec-kit project exists by checking for T383838.specify/ directory
2. Verify git is available and the project is a git repository
3. Verify the project has existing source code to migrate (not an empty project)
4. Verify constitution exists (recommend running T383838/speckit.brownfield.bootstrap first if missing)
Outline
1. Identify migration targets: Determine what to migrate based on user input:
βββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Input β Action β
βββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Specific feature name β Locate the feature in the codebase by searching for related files, moduβ¦ β
β Specific branch name β Analyze the branch's commits and changed files to identify the feature β¦ β
β Module path β Treat the entire module as a single feature to migrate β
β T383838all β List all identifiable features and let the user select which to migrate β
β No input β Show a list of detected features and ask the user to pick one β
βββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2. Detect feature boundaries: For each migration target, determine its scope:
β’ Files: Which source files implement this feature
β’ Tests: Which test files cover this feature
β’ Dependencies: What other modules or services this feature depends on
β’ API surface: Endpoints, functions, or interfaces exposed by this feature
β’ Database: Migrations, models, or schema changes related to this feature
3. Reverse-engineer spec.md: Analyze the code to reconstruct what the feature does:
β’ User scenarios: Infer from test cases, route handlers, and UI components
β’ Requirements: Extract from code behavior, validation rules, and error handling
β’ Success criteria: Derive from test assertions and acceptance patterns
β’ Assumptions: Note any hardcoded values, environment dependencies, or implicit requirements
β’ Mark the spec as T383838status: migrated to distinguish from specs created through the normal workflow
4. Reverse-engineer plan.md: Reconstruct the implementation approach:
β’ Technical context: Actual frameworks, libraries, and patterns used
β’ Project structure: Where the feature's code lives in the project
β’ Complexity assessment: Based on file count, line count, and dependency depth
5. Reverse-engineer tasks.md: Create a task list reflecting what was actually built:
β’ Each major component or module becomes a task group
β’ Mark all tasks as T383838[x] (completed) since the feature already exists
β’ Include test tasks based on actual test files found
β’ Note any gaps: code without tests, features without error handling
6. Create feature branch and artifacts: For each migrated feature:
β’ Create a feature directory: T383838specs/{feature-name}/
β’ Write T383838spec.md, T383838plan.md, and T383838tasks.md into the feature directory
β’ Do not create a git branch β the feature already exists on its branch or main
7. Present migration plan: Show what will be created before writing:
T282828
# Migration Plan: User Authentication
## Detected Scope
| Category | Files | Lines |
|----------|-------|-------|
| Source | 8 files | ~420 lines |
| Tests | 3 files | ~180 lines |
| Migrations | 2 files | ~45 lines |
## Artifacts to Generate
| File | Content |
|------|---------|
| Ta5d6ff`specs/user-auth/spec.md` | 4 user scenarios, 12 requirements, 6 success criteria |
| Ta5d6ff`specs/user-auth/plan.md` | 3 implementation phases, 8 technical decisions |
| Ta5d6ff`specs/user-auth/tasks.md` | 14 tasks (all completed), 2 gaps identified |
## Gaps Found
Tff7b72- β οΈ No error handling tests for expired tokens
Tff7b72- β οΈ No rate limiting on login endpoint
Proceed with migration?
8. Execute migration: After user confirmation, write all artifacts.
9. Report:
T282828
# Migration Complete: User Authentication
| Artifact | Status |
|----------|--------|
| spec.md | β
Created β 4 scenarios, 12 requirements |
| plan.md | β
Created β 3 phases |
| tasks.md | β
Created β 14/14 tasks complete |
## Identified Gaps
Tff7b721. No error handling tests for expired tokens β consider Ta5d6ff`/speckit.specify` for a follow-up feature
Tff7b722. No rate limiting on login endpoint β consider Ta5d6ff`/speckit.bugfix.report` to track
## Next Steps
Tff7b72- Review generated artifacts in Ta5d6ff`specs/user-auth/`
Tff7b72- Use Ta5d6ff`/speckit.refine.update` to adjust any inaccurate specs
Tff7b72- Use Ta5d6ff`/speckit.specify` for new features β they'll follow the same SDD workflow
Tff7b72- Run Ta5d6ff`/speckit.brownfield.migrate` again for additional features
Rules
β’ Always confirm before writing β show the migration plan and wait for user approval
β’ Honest assessment β if the code is unclear or poorly documented, say so in the spec rather than inventing explanations
β’ Mark as migrated β all migrated specs must include T383838status: migrated to distinguish from fresh specs
β’ Identify gaps β actively look for missing tests, error handling, or documentation and report them
β’ Non-destructive β never modify existing source code, only create spec artifacts
β’ One feature at a time β for "all" input, migrate features sequentially with confirmation between each
β’ Respect constitution β generated artifacts must follow the project's constitution rules
Served by rngit 1.5.2 - Generated in 0.08s